package com.lantu.draw.login.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lantu.draw.login.mapper.UserMapper;
import com.lantu.draw.login.vo.UserVO;
@Service
public class LoginServiceImpl implements LoginService {
	@Autowired
	UserMapper userMapper;
	@Override
	public boolean login(String usrid,String pwd) {
		UserVO vo=userMapper.selectVOByPKId(usrid);
		if(vo!=null&&vo.getPwd().equals(pwd) ) return true;
		return false;
	}
	public boolean usrexists(String usrid) {
		UserVO qo=new UserVO();
		qo.setUsrid(usrid);
		// 判断用户已经存在
		int ct = userMapper.queryCount(qo);
		if (ct > 0) {
			return true;
		}else{
			return false;
		}
	}
	@Override
	public boolean register(String usrid, String pwd) {
		UserVO vo=new UserVO();
		vo.setUsrid(usrid);
		vo.setPwd(pwd);
		userMapper.insert(vo);
		return true;
	}

}
